<?php
/**
 * Created by PhpStorm.
 * User: l
 * Date: 2016/7/21
 * Time: 13:46
 */
namespace app\models;

use Yii;
use yii\db\ActiveRecord;

class Banner extends ActiveRecord {


    public function getTableData($limit,$offset){
        $total = (new \yii\db\Query())
            ->from('hcps_banner')
            ->where(['del_flag' => 1])
            ->count();
        $query=new \yii\db\Query();
        $rows = $query->where(['del_flag' => 1])->from('hcps_banner')->orderBy('create_time DESC')->limit($limit)->offset($offset)->all();
        $rs=['total'=>$total,'rows'=>$rows];
        return $rs;
    }

    public function getBannerContent($banner_id){
        $content = Banner::find()->where(['banner_id' => $banner_id,'del_flag' => 1])->select('content')->scalar();
        return $content;
    }



}